package com.yuxin.wx.controller;

import com.yuxin.wx.rabbitmq.MQSender;
import com.yuxin.wx.result.Result;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @Description: rabbitmq 测试
 * @Author: zcq
 * @Date: 2018/7/1 下午5:11
 */
@RestController
@RequestMapping("/demo")
public class MqController {
	@Autowired
	private MQSender sender;

	@RequestMapping("/mq")
	public Result<String> sendMq() {
		sender.send("Hello world");
		return Result.success("hello,zcq");
	}

	@RequestMapping("/mq/topic")
	public Result<String> sendTopicMq() {
		sender.sendTopic("Hello world");
		return Result.success("hello,zcq");
	}

	@RequestMapping("/mq/fanout")
	public Result<String> sendFanoutMq() {
		sender.sendFanout("Hello world");
		return Result.success("hello,zcq");
	}

	@RequestMapping("/mq/header")
	public Result<String> sendHeaderMq() {
		sender.sendHeader("Hello world header");
		return Result.success("hello,zcq");
	}
}
